<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>MyReduce</title>
</head>
<body>
    
    <script type="module">
        // import myReduce from './js/12_MyReduce/MyReduce.js'

        // 第1次手写
        // import myReduce from './js/12_MyReduce/MyReduce1.js'

        // 第2次手写
        // import myReduce from './js/12_MyReduce/MyReduce2.js'

        // 第3次手写
        // import myReduce from './js/12_MyReduce/MyReduce3.js'

        // 第4次手写
        import myReduce from './js/12_MyReduce/MyReduce4.js'

        let arr = [1, 2, 3, 4, 5]
        const res = arr.myReduce((pre, cur) => pre + cur, 50)
        console.log(res)

        const res1 = arr.myReduce((pre, cur) => pre + cur)
        console.log(res1)
        
        let a = 1
        const res2 = a.myReduce((pre, cur) => pre + cur)
        console.log(res2)
    </script>
</body>
</html>